const express = require('express');
const router = express.Router();
const loadApiController = function(controllerName) {
    return require(`../../controllers/v1.0/${controllerName}`)
};
const auth = require('../../middleware/auth')
const miniauth = require('../../middleware/miniauth');


const LogController = loadApiController('LogController')
const CommonController = loadApiController('CommonController')
const UserController = loadApiController('UserController')
const AdminController = loadApiController('AdminController')
const MessageController = loadApiController('MessageController')


const DailyTasksController = loadApiController('DailyTasksController')
router.post('/ping', auth, (req, res, next) => {
    return res.json({
        code: 200,
    })
});


router.post('/user/changePassword', UserController.changePassword); // changePassword,更改密码



router.post('/admin/getRoles', auth, AdminController.getRoles);
router.post('/admin/changeOneAdmin', auth, AdminController.changeOneAdmin);
router.post('/admin/getAdminList', auth, AdminController.getAdminList);
router.post('/admin/deleteOneAdmin', auth, AdminController.deleteOneAdmin);
router.post('/admin/getOneAdmin', auth, AdminController.getOneAdmin);
router.post('/admin/addAccount', AdminController.addAccount);

router.post('/common/login', UserController.userLogin); //user login interface
router.post('/common/getMenuListDefault', CommonController.getMenuListDefault);
router.post('/common/getMenuListAfterLogin', CommonController.getMenuListAfterLogin);
router.post('/common/userLoginOut', UserController.userLoginOut);

router.post('/user/getOneUser',UserController.getOneUser)
router.post('/user/getOneChat',UserController.getOneChat)


router.post('/daily/getIndexDetail',DailyTasksController.getIndexDetail)
router.post('/daily/getNewChatDetail',auth, DailyTasksController.getNewChatDetail)
router.post('/log/getLogList', LogController.getLogList);


router.post('/message/addMessageModel', MessageController.addMessageModel);
router.post('/message/updateMessageModel', MessageController.updateMessageModel);
router.post('/message/getMessageModelList', MessageController.getMessageModelList);
router.post('/message/deleteMessageModel', MessageController.deleteMessageModel);
router.post('/message/getOneDouyinAccount', MessageController.getOneDouyinAccount);

router.post('/message/getOneDouyinAccount', MessageController.getOneDouyinAccount);
router.post('/message/addDouyinAccount', MessageController.addDouyinAccount);
router.post('/message/updateDouyinAccount', MessageController.updateDouyinAccount);
router.post('/message/getDouyinAccountList', MessageController.getDouyinAccountList);
router.post('/message/deleteDouyinAccount', MessageController.deleteDouyinAccount);

router.post('/message/getOneTargetLink', MessageController.getOneTargetLink);
router.post('/message/addTargetLink', MessageController.addTargetLink);
router.post('/message/updateTargetLink', MessageController.updateTargetLink);
router.post('/message/getTargetLinkList', MessageController.getTargetLinkList);
router.post('/message/deleteTargetLink', MessageController.deleteTargetLink);

/**
 * Data
 *
 */






module.exports = router;